﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;
using Newtonsoft;
using Newtonsoft.Json;
using System.IO;
using Newtonsoft.Json.Linq;

namespace yaotong
{
    class Program
    {
        static List<yaocai> listyaocai = new List<yaocai>();
        static void Main(string[] args)
        {

            string url = string.Format("http://www.yt1998.com/price/nowDayPriceQ!getPriceList.do?random=0.10809691769164886&ycnam=&market=1&leibie=&istoday=&spices=&paramName=&paramValue=&pageIndex=0&pageSize=100");
            HtmlWeb web = new HtmlWeb();
            HtmlDocument doc = web.Load(url);
            string str =  doc.DocumentNode.InnerText;
            JObject jo = (JObject)JsonConvert.DeserializeObject(str);
            string data = jo["data"].ToString();
            
            JsonSerializer serializer = new JsonSerializer();
            foreach (var da in jo["data"])
            {
                StringReader sr = new StringReader(da.ToString());
                yaocai yc = (yaocai)serializer.Deserialize(new JsonTextReader(sr), typeof(yaocai));
                listyaocai.Add(yc);
            }
            Console.ReadLine();
        }
    }
}
